<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/9/27
  Time: 20:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>我的订单</title>
    <%@include file="/common/head.jsp"%>
</head>
<body>
<c:if test="${sessionScope.user.id!=requestScope.userId}">
    <div align="right">
        <font color="red" face="楷体" size="3">
            <%@include file="/common/managerMenu.jsp"%>
        </font>
    </div>
</c:if>
<c:if test="${sessionScope.user.id==requestScope.userId}">
    <div align="right">
        <font color="red" face="楷体" size="3">
            <%@include file="/common/userMenu.jsp"%>
        </font>
    </div>
</c:if>
<c:if test="${not empty requestScope.page}">
<%--不为空显示订单详情--%>
    <table align="center" border="1">
        <tr>
            <th>商品名称</th>
            <th>订单号</th>
            <th>单价</th>
            <th>购买数量</th>
            <th>总价</th>
            <th>购买时间</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${requestScope.page.items}" var="order">
            <tr>
                <td>${order.name}</td>
                <td>${order.order_id}</td>
                <td>${order.price}</td>
                <td>${order.count}</td>
                <td>${order.total_price}</td>
                <td>${order.create_time}</td>
                <td style="color: greenyellow">
                    <c:if test="${order.status==0}">
                        <font color="red" face="楷体">未发货</font>
                    </c:if>
                    <c:if test="${order.status==1}">
                        <font color="#7fff00" face="楷体">已发货</font>
                    </c:if>
                    <c:if test="${order.status==2}">
                        <font color="#5f9ea0" face="楷体">已签收</font>
                    </c:if>
                </td>
                <td>
                    <c:if test="${sessionScope.user.id==requestScope.userId}">
                        <c:if test="${order.status==2}">
                            ---
                        </c:if>
                        <c:if test="${order.status!=2}">
                            <a href="os?action=receiverOrder&orderId=${order.order_id}" style="text-decoration: none;color: cadetblue" class="changeStatus">签收</a>
                        </c:if>
                    </c:if>
                    <c:if test="${sessionScope.user.id!=requestScope.userId}">
                        <c:if test="${order.status==0}">
                            <a href="os?action=sendOrder&orderId=${order.order_id}" style="text-decoration: none;color: cadetblue" class="changeStatus">发货</a>
                        </c:if>
                        <c:if test="${order.status!=0}">
                            ---
                        </c:if>
                    </c:if>
                </td>
            </tr>
        </c:forEach>
        <script type="text/javascript">
            $(function () {
                $("a.changeStatus").click(function () {
                    return confirm("确定要修改《"+$(this).parent().parent().find("td:first").text()+"》的状态吗？");
                });
            })
        </script>
    </table>
    <%@include file="/common/paging_bar.jsp"%>
</c:if>
<c:if test="${empty requestScope.page}">
<%--为空显示提示语--%>
    您从未购买过我店的任何商品！
</c:if>
</body>
</html>
